<?php
class mySql_Class
{
	function class_all(){
		$class_arr=array();
		$query = mysql_query("select * from gy_class order by sort asc, id Desc");
		while($row =mysql_fetch_array($query)){
			$class_arr[] = array($row['id'],$row['name'],$row['up'],$row['sort']);
		}
		return $class_arr;
	}

	function query($sql)//执行SQL语句
	{
		return @mysql_query($sql);
	}
	
	function fetch_array($fetch_array)
	{
		return @mysql_fetch_array($fetch_array, MYSQL_ASSOC);
	}
	
	
	function close() //关闭数据库
	{ 
		return @mysql_close();
	}
	
	function insert($table,$arr) //添加记录
	{
		$sql = $this -> query("INSERT INTO `$table` (`".implode('`,`', array_keys($arr))."`) VALUES('".implode("','", $arr)."')");
		return $sql;
	}





}

?>